﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BibleBase
{
    public class Abreviaturas
    {
        List<Tuple<string, string, string>> mapeo = new List<Tuple<string, string, string>>();
        public bool Add(string libro, string abrev1, string abrev2)
        {
            if (libro.Length > 0 && !mapeo.Any(x => x.Item1 == libro))
            {
                mapeo.Add(new Tuple<string, string, string>(libro, abrev1, abrev2));
                return true;
            }
            return false;
        }

        public bool IsAbrev(string text)
        {
            return mapeo.Any(x => x.Item2 == text || x.Item3 == text);
        }

        public string GetBookName(string text)
        {
            return mapeo.Where(x => x.Item2 == text || x.Item3 == text).Select(x => x.Item1).Single();
        }
    }
}
